﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="DemoGridView_Default2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
&nbsp;
        <asp:TextBox ID="pname" runat="server" style="margin-top: 0px"></asp:TextBox>
&nbsp;
        <asp:Button ID="Button1" runat="server" onclick="Button1_Click" 
            PostBackUrl="~/DemoGridView/Default2.aspx" Text="Button" />
        <br />
        <br />
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataKeyNames="PId" DataSourceID="SqlDataSource1">
            <Columns>
                <asp:BoundField DataField="PId" HeaderText="PId" ReadOnly="True" 
                    SortExpression="PId" />
                <asp:BoundField DataField="PName" HeaderText="PName" SortExpression="PName" />
                <asp:BoundField DataField="Size" HeaderText="Size" SortExpression="Size" />
                <asp:BoundField DataField="Price" HeaderText="Price" SortExpression="Price" />
                <asp:BoundField DataField="Lang" HeaderText="Lang" SortExpression="Lang" />
                <asp:BoundField DataField="Picture" HeaderText="Picture" 
                    SortExpression="Picture" />
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:C1204MConnectionString %>" 
            SelectCommand="SELECT [PId], [PName], [Size], [Price], [Lang], [Picture] FROM [Product] WHERE ([PName] LIKE '%' + @PName + '%')">
            <SelectParameters>
                <asp:FormParameter FormField="pname" Name="PName" Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>
    
    </div>
    </form>
</body>
</html>
